package com.practice.mybatis.v2;

import com.practice.mybatis.v1.Test;
import com.practice.mybatis.v2.config.Configuration;
import com.practice.mybatis.v2.config.mapper.TestMapper;
import com.practice.mybatis.v2.executor.ExecutorFactory;
import com.practice.mybatis.v2.session.SqlSession;

public class Bootstrap {
	
	public static void main(String[] args) {
		Configuration configuration = new Configuration();
        configuration.scanPath("com.practice.mybatis.v2.config.mapper");
        configuration.build();
        
        SqlSession sqlSession = new SqlSession(configuration,
                ExecutorFactory.get(ExecutorFactory.ExecutorType.SIMPLE.name(),configuration));
        TestMapper testMapper = sqlSession.getMapper(TestMapper.class);
        long start = System.currentTimeMillis();
        Test test = testMapper.selectByPrimaryKey("1");
        System.out.println(test.toString());
        System.out.println("cost:"+ (System.currentTimeMillis() -start));
	}

}
